package fivm.cross.platform.steamobj.app;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import fivm.cross.platform.ficommon.distinguish.GsonSimpleSerializable;

/**
 * Created by Administrator on 2016/5/28.
 */
public class HookParamConfig extends GsonSimpleSerializable {
    public static final  int HOOK_SET=1;				//是否hook  __system_property_set
    public static final int  HOOK_GET=2;				//是否hook	__system_property_get
    public static final int  MODIFY_SET_VALUE=4;		//是否改变原来的值
    public static final int  MODIFY_GET_VALUE=8;		//是否改变原来的值
    public static final int  HOOK_CUTILS=0x10;			//定义是否是hook libcutils里面的函数还是libc里面的,其中__system_property_get对应libc，property_get对应libcutils



    @Expose @SerializedName("EnableHookSetProp")
    private boolean enableHookSetProp=true;
    @Expose @SerializedName("EnableHookGetProp")
    private boolean enableHookGetProp=true;
    @Expose @SerializedName("enableModifySetProp")
    private boolean enableModifySetProp=true;
    @Expose @SerializedName("enableModifyGetProp")
    private boolean enableModifyGetProp=true;
    @Expose @SerializedName("EnableLibcutils")
    private boolean enableLibcutils=true;

    private int propInitial=0;

    public boolean isEnableHookSetProp() {
        return enableHookSetProp;
    }

    public void setEnableHookSetProp(boolean enableHookSetProp) {
        this.enableHookSetProp = enableHookSetProp;
    }

    public boolean isEnableHookGetProp() {
        return enableHookGetProp;
    }

    public void setEnableHookGetProp(boolean enableHookGetProp) {
        this.enableHookGetProp = enableHookGetProp;
    }

    public boolean isEnableModifySetProp() {
        return enableModifySetProp;
    }

    public void setEnableModifySetProp(boolean enableModifySetProp) {
        this.enableModifySetProp = enableModifySetProp;
    }

    public boolean isEnableModifyGetProp() {
        return enableModifyGetProp;
    }

    public void setEnableModifyGetProp(boolean enableModifyGetProp) {
        this.enableModifyGetProp = enableModifyGetProp;
    }

    public boolean isEnableLibcutils() {
        return enableLibcutils;
    }

    public void setEnableLibcutils(boolean enableLibcutils) {
        this.enableLibcutils = enableLibcutils;
    }

    public int getPropInitial() {
        int retPropIni=0;
        if(enableHookSetProp)
            retPropIni = retPropIni | HOOK_SET;
        if(enableHookGetProp)
            retPropIni = retPropIni | HOOK_GET;
        if(enableModifySetProp)
            retPropIni = retPropIni | MODIFY_SET_VALUE;
        if(enableModifyGetProp)
            retPropIni = retPropIni | MODIFY_GET_VALUE;
        if(enableLibcutils)
            retPropIni = retPropIni | HOOK_CUTILS;
        return retPropIni;
    }

    public void setPropInitial(int propInitial) {
        this.propInitial = propInitial;
    }
}
